<template>
  <div class="menu-switch">
    <div class="switch-container">
      <div 
        class="switch-item" 
        :class="{ active: currentRole === 'owner' }"
        @click="switchRole('owner')"
      >
        我是业主
      </div>
      <div 
        class="switch-item" 
        :class="{ active: currentRole === 'merchant' }"
        @click="switchRole('merchant')"
      >
        我是商家
      </div>
    </div>

    <div class="form-content">
      <div class="form-item">
        <div class="label">联系人</div>
        <input type="text" placeholder="请输入联系人">
      </div>
      <div class="form-item">
        <div class="label">联系电话</div>
        <input type="text" placeholder="请输入联系电话">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      currentRole: 'owner' // 默认选中业主
    }
  },
  methods: {
    switchRole(role) {
      this.currentRole = role
    }
  }
}
</script>

<style lang="scss" scoped>
.menu-switch {
  padding: 20px;
  
  .switch-container {
    display: flex;
    background: #f5f5f5;
    padding: 0;
    margin-bottom: 20px;
    position: relative;
    height: 44px;
    border: 1px solid #e4e7ed;
    overflow: hidden;
  }

  .switch-item {
    flex: 1;
    text-align: center;
    line-height: 44px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    background: transparent;
    z-index: 1;
    overflow: visible;

    &:first-child {
      border-top-right-radius: 22px;

      &.active::after {
        content: '';
        position: absolute;
        right: -22px;
        bottom: -22px;
        width: 44px;
        height: 44px;
        background: #fff;
        border-top-left-radius: 44px;
        z-index: 0;
      }
    }

    &:last-child {
      border-bottom-left-radius: 22px;

      &.active::before {
        content: '';
        position: absolute;
        left: -22px;
        top: -22px;
        width: 44px;
        height: 44px;
        background: #fff;
        border-bottom-right-radius: 44px;
        z-index: 0;
      }
    }

    &.active {
      color: #409EFF;
      background: #fff;
    }
  }

  .form-content {
    .form-item {
      margin-bottom: 15px;
      
      .label {
        font-size: 14px;
        color: #333;
        margin-bottom: 8px;
      }

      input {
        width: 100%;
        height: 40px;
        border: 1px solid #dcdfe6;
        border-radius: 4px;
        padding: 0 15px;
        font-size: 14px;
        
        &::placeholder {
          color: #999;
        }
      }
    }
  }
}
</style>
